require "starruby"
require "./scripts/scene_stack"
require "./scripts/play_scene"
require "./simple_input"

include StarRuby
require "resource_manager"
$res = ResourceManager.new(".", "/images/", "/sounds/se/", "/sounds/bgm/")

require  "extension"
#DEFAULT_FONT = Font.new("Verdana", 12)
#BIG_FONT = Font.new("Verdana", 24)

SCREEN_WIDTH = 320
SCREEN_HEIGHT = 320

Game.title = "New Game"
Game.fps = 30

scene_stack = SceneStack.new(DGame::PlayScene.new)

Game.run(SCREEN_WIDTH, SCREEN_HEIGHT, :window_scale => 1, :fullscreen => false) do
  Game.screen.fill(StarRuby::Color.new(128, 128, 128, 255))

  current_scene = scene_stack.current
  if current_scene
    current_scene.update(scene_stack)
    current_scene.render(Game.screen)
  else
    Game.terminate
  end
  Game.terminate if SimpleInput.pressed_newly?(:escape)
  Game.screen.render_number(Game.real_fps.floor.to_s, 5, 2, :small)
end
